﻿using log4net;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;

namespace WebServiceShopping
{
    public class wechartTools
    {

 
        private const string appid = "wx9dd93984bf291011";
        private const string appsecret = "8ddb2992cb58bbebac2919c7ee440e49";
        private const string ALLminiprogram_state = "formal";
        private static string token = string.Empty;
        private static DateTime tokenTime = DateTime.Now.AddDays(-1);

        //获取token
      
        private static string getToken()
        {
    
            ILog logJieKou = LogManager.GetLogger("LoggerWeb");
             
            token = string.Empty;
            int index = 3;
            First:
            try
            {
                WebRequest request = (WebRequest)HttpWebRequest.Create($"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={appid}&secret={appsecret}");
                request.Method = "GET";
                request.ContentType = "application/x-www-form-urlencoded";
                string result = string.Empty;
                using (WebResponse response = request.GetResponse())
                {
                    if (response != null)
                    {
                        using (Stream stream = response.GetResponseStream())
                        {
                            using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
                            {
                                result = reader.ReadToEnd();
                            }
                        }
                    }
                }
                if (!string.IsNullOrWhiteSpace(result))
                {
                    Newtonsoft.Json.Linq.JToken json = Newtonsoft.Json.JsonConvert.DeserializeObject<JToken>(result);
                    token = json.Value<string>("access_token");
                    tokenTime = DateTime.Now.AddSeconds(json.Value<int>("expires_in"));
                    logJieKou.Info("获取token:" + token);
                    return token;
                }
            }
            catch (Exception ex)
            {
                logJieKou.Info("获取token异常:" + ex);
            }
            index--;
            if (index > 0)
                goto First;

            logJieKou.Info("获取token:" + token);
            return token;
        }

        private static string getTokenGZH()
        {

            ILog logJieKou = LogManager.GetLogger("LoggerWeb");

            token = string.Empty;
            int index = 3;
            First:
            try
            {

                WebRequest request = (WebRequest)HttpWebRequest.Create($"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wxbf28439203a3fd18&secret=60e26ecb2ddeae1a3d9b936d08002ac7");

                request.Method = "GET";
                request.ContentType = "application/x-www-form-urlencoded";
                string result = string.Empty;
                using (WebResponse response = request.GetResponse())
                {
                    if (response != null)
                    {
                        using (Stream stream = response.GetResponseStream())
                        {
                            using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
                            {
                                result = reader.ReadToEnd();
                            }
                        }
                    }
                }
           
                if (!string.IsNullOrWhiteSpace(result))
                {
                    Newtonsoft.Json.Linq.JToken json = Newtonsoft.Json.JsonConvert.DeserializeObject<JToken>(result);
                    token = json.Value<string>("access_token");
                    tokenTime = DateTime.Now.AddSeconds(json.Value<int>("expires_in"));
                    return token;
                }
            }
            catch (Exception ex)
            {
                logJieKou.Info("获取token异常:" + ex);
            }
            index--;
            if (index > 0)
                goto First;

            logJieKou.Info("获取token:" + token);
            return token;
        }

        //发消息
        public static bool SendMsg(WeChartMsg model)
        {
            ILog logJieKou = LogManager.GetLogger("LoggerWeb");
            logJieKou.Info("发送微信公众号消息:" + DateTime.Now);
            var para = Newtonsoft.Json.JsonConvert.SerializeObject(model);
            logJieKou.Info(para);
            byte[] byData = Encoding.UTF8.GetBytes(para);
            int index = 3;
            First:
            try
            {
                var _token = getToken();
                WebRequest request = (WebRequest)HttpWebRequest.Create($"https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token={_token}");
                request.Method = "POST";
                request.Timeout = 5000;
                request.ContentType = "application/json";
                request.ContentLength = byData.Length;
                // 提交数据
                Stream rs = request.GetRequestStream();
                rs.Write(byData, 0, byData.Length);
                rs.Close();

                // 取响应结果
                HttpWebResponse resp = request.GetResponse() as HttpWebResponse;
                StreamReader sr = new StreamReader(resp.GetResponseStream(), Encoding.UTF8);

                var result = sr.ReadToEnd();

                if (!string.IsNullOrWhiteSpace(result))
                {
                    Newtonsoft.Json.Linq.JToken json = Newtonsoft.Json.JsonConvert.DeserializeObject<JToken>(result);
                    if (json.Value<int>("errcode") == 0)
                    {
                        return true;
                    }
                    else
                    {
                        throw new Exception(json.Value<string>("errcode")+"-"+json.Value<string>("errmsg"));
                    }
                }
            }
            catch (Exception ex)
            {
                logJieKou.Info("消息发送异常:" + ex);
            }
            index--;
            if (index > 0)
                goto First;
            return false;
        }

        //公众号发布
        public static bool SendMsgGZH(WeChartMsg model)
        {
            ILog logJieKou = LogManager.GetLogger("LoggerWeb");
            logJieKou.Info("发送微信公众号消息:" + DateTime.Now);
            var para = Newtonsoft.Json.JsonConvert.SerializeObject(model);
            logJieKou.Info(para);
            byte[] byData = Encoding.UTF8.GetBytes(para);
            int index = 3;
            First:
            try
            {
    
                var _token = getTokenGZH();
          
                WebRequest request = (WebRequest)HttpWebRequest.Create($"https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={_token}");
                request.Method = "POST";
                request.Timeout = 5000;
                request.ContentType = "application/json";
                request.ContentLength = byData.Length;

                // 提交数据
                Stream rs = request.GetRequestStream();
                rs.Write(byData, 0, byData.Length);
                rs.Close();

                // 取响应结果
                HttpWebResponse resp = request.GetResponse() as HttpWebResponse;
                StreamReader sr = new StreamReader(resp.GetResponseStream(), Encoding.UTF8);

                var result = sr.ReadToEnd();

                if (!string.IsNullOrWhiteSpace(result))
                {
                    Newtonsoft.Json.Linq.JToken json = Newtonsoft.Json.JsonConvert.DeserializeObject<JToken>(result);
                    if (json.Value<int>("errcode") == 0)
                    {
                        return true;
                    }
                    else
                    {
                        throw new Exception(json.Value<string>("errcode") + "-" + json.Value<string>("errmsg"));
                    }
                }
            }
            catch (Exception ex)
            {
                logJieKou.Info("消息发送异常:" + ex);
            }
            index--;
            if (index > 0)
                goto First;
            return false;
        }

        //获取二维码
        public static string GetXCXBMP(XcxBmpMsg model)
        {
            ILog logJieKou = LogManager.GetLogger("LoggerWeb");
            logJieKou.Info("获取小程序的动态二维码:" + DateTime.Now);
            var para = Newtonsoft.Json.JsonConvert.SerializeObject(model);
            logJieKou.Info(para);
            byte[] byData = Encoding.UTF8.GetBytes(para);
            int index = 3;
        
            First:
            try
            {
                var _token = getToken();
           
                WebRequest request = (WebRequest)HttpWebRequest.Create($"https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={_token}");
                request.Method = "POST";
                request.Timeout = 5000;
                request.ContentType = "application/json";
                request.ContentLength = byData.Length;
                // 提交数据
                Stream rs = request.GetRequestStream();
                rs.Write(byData, 0, byData.Length);
                rs.Close();

                // 取响应结果
                HttpWebResponse resp = request.GetResponse() as HttpWebResponse;
                StreamReader sr = new StreamReader(resp.GetResponseStream(), Encoding.UTF8);

                var result = sr.ReadToEnd();
            //    logJieKou.Info("获取二维码:" + result);
                if (!string.IsNullOrWhiteSpace(result))
                {
                        return result;
                }
            }
            catch (Exception ex)
            {
                logJieKou.Info("获取二维码异常1:" + ex);
            }
            index--;
            if (index > 0)
                goto First;
            return "-1";
        }


        public class XcxBmpMsg
        {
            /// <summary>
            ///参数
            /// </summary>
            public string scene { get; set; }
            public string page { get; set; } = "pages/ldp/index";
        }


        public class WeChartMsg
        {
            /// <summary>
            /// 接收人openid
            /// </summary>
            public string touser { get; set; }
            /// <summary>
            /// 消息模板ID，固定不能动
            /// </summary>
            public string template_id { get; set; }
        }
        /// <summary>
        /// 新订单通知
        /// </summary>
        public class OrderMsg : WeChartMsg
        {
            /// <summary>
            /// 消息模板ID，固定不能动
            /// </summary>
            public new string template_id { get; set; } = "TamBbhlMJTRXlnU7F0Hay_8nALvQXztTLxh01xFzvPE";
            /// <summary>
            /// 小程序链接
            /// </summary>
            public XCXPath miniprogram { get; set; }

            public DataModel data { get; set; }
            /// <summary>
            /// 消息内容
            /// </summary>
            public class DataModel
            {
                /// <summary>
                /// 消息首行信息
                /// </summary>
                public DataItem first { get; set; } = new DataItem()
                {
                    value = "您有新的订单"
                };

                /// <summary>
                /// 类型
                /// </summary>
                public DataItem keyword1 { get; set; }
                /// <summary>
                /// 编号
                /// </summary>
                public DataItem keyword2 { get; set; }
                /// <summary>
                /// 时间
                /// </summary>
                public DataItem keyword3 { get; set; }
                /// <summary>
                /// 备注
                /// </summary>
                public DataItem remark { get; set; } = new DataItem()
                {
                    value = "请及时处理。点击本消息可直接进入小程序处理！"
                };
            }
        }


        /// <summary>
        /// 新的询价通知
        /// </summary>
        public class XunJiaMsg : WeChartMsg
        {
            /// <summary>
            /// 消息模板ID，固定不能动
            /// </summary>
            public new string template_id { get; set; } = "KNZDD7armBFgTNFUMNo3oAnumNOfCumGR72zercnvc4";
            /// <summary>
            /// 小程序链接
            /// </summary>
            public XCXPath miniprogram { get; set; }

            public DataModel data { get; set; }
            /// <summary>
            /// 消息内容
            /// </summary>
            public class DataModel
            {
                /// <summary>
                /// 消息首行信息
                /// </summary>
                public DataItem first { get; set; } = new DataItem()
                {
                    value = "您好，您有新的预约单！"
                };
                public DataItem keyword1 { get; set; }

                public DataItem keyword2 { get; set; }

                public DataItem keyword3 { get; set; }

                public DataItem keyword4 { get; set; }

                /// <summary>
                /// 备注
                /// </summary>
                public DataItem remark { get; set; } = new DataItem()
                {
                    value = "请及时处理。点击本消息可直接进入小程序处理！"
                };
            }
        }


        /// <summary>
        /// 预约订单通知
        /// </summary>
        public class YuYueMsg : WeChartMsg
        {
            /// <summary>
            /// 消息模板ID，固定不能动
            /// </summary>
            public new string template_id { get; set; } = "w1IOLOEmBmjJNeHlfRyewSWjqMK7ldUF7DvNBXIL9Tc";
            /// <summary>
            /// 小程序链接
            /// </summary>
            public XCXPath miniprogram { get; set; }

            public DataModel data { get; set; }
            /// <summary>
            /// 消息内容
            /// </summary>
            public class DataModel
            {
                /// <summary>
                /// 消息首行信息
                /// </summary>
                public DataItem first { get; set; } = new DataItem()
                {
                    value = "您好，您有新的预约单！"
                };
                public DataItem keyword1 { get; set; }
      
                public DataItem keyword2 { get; set; }
         
                public DataItem keyword3 { get; set; }
        
                public DataItem keyword4 { get; set; }
    
                public DataItem keyword5 { get; set; }
                /// <summary>
                /// 备注
                /// </summary>
                public DataItem remark { get; set; } = new DataItem()
                {
                    value = "请及时处理。点击本消息可直接进入小程序处理！"
                };
            }
        }


        /// <summary>
        /// 检测确认通知
        /// </summary>
        public class YHCheckMsg : WeChartMsg
        {
            /// <summary>
            /// 消息模板ID，固定不能动
            /// </summary>
            public new string template_id { get; set; } = "-Qwx0GYU1nE1D-U3_EDSGezDeJg1B_2jIvMPYObYpNs";
            /// <summary>
            /// 小程序链接
            /// </summary>
            public XCXPath miniprogram { get; set; }

            public DataModel data { get; set; }
            /// <summary>
            /// 消息内容
            /// </summary>
            public class DataModel
            {
                /// <summary>
                /// 消息首行信息
                /// </summary>
                public DataItem first { get; set; }
                public DataItem keyword1 { get; set; }

                public DataItem keyword2 { get; set; }

                /// <summary>
                /// 备注
                /// </summary>
                public DataItem remark { get; set; } = new DataItem()
                {
                    value = "请及时处理。点击本消息可直接进入小程序处理！"
                };
            }
        }


        /// <summary>
        /// 支付成功通知
        /// </summary>
        public class PayOKMsg : WeChartMsg
        {
            /// <summary>
            /// 消息模板ID，固定不能动
            /// </summary>
            public new string template_id { get; set; } = "QQJsX8JYmpXvTkkWHsLVw8cgSmtnawR27c2M9P8CZNs";
            /// <summary>
            /// 小程序链接
            /// </summary>
            public XCXPath miniprogram { get; set; }

            public DataModel data { get; set; }
            /// <summary>
            /// 消息内容
            /// </summary>
            public class DataModel
            {
                /// <summary>
                /// 消息首行信息
                /// </summary>
                public DataItem first { get; set; }
                public DataItem keyword1 { get; set; }

                public DataItem keyword2 { get; set; }
                public DataItem keyword3 { get; set; }

                public DataItem keyword4 { get; set; }
                /// <summary>
                /// 备注
                /// </summary>
                public DataItem remark { get; set; } = new DataItem()
                {
                    value = "请及时处理。点击本消息可直接进入小程序处理！"
                };
            }
        }


        /// <summary>
        /// 发货通知
        /// </summary>
        public class FaHuoMsg : WeChartMsg
        {
            /// <summary>
            /// 消息模板ID，固定不能动
            /// </summary>
            public new string template_id { get; set; } = "Fn96DiAsUYBTAnwep82g5MepwjH4e5VkDxghcy-gdg4";
            /// <summary>
            /// 小程序链接
            /// </summary>
            public XCXPath miniprogram { get; set; }

            public DataModel data { get; set; }
            /// <summary>
            /// 消息内容
            /// </summary>
            public class DataModel
            {
                /// <summary>
                /// 消息首行信息
                /// </summary>
                public DataItem first { get; set; }
                public DataItem keyword1 { get; set; }

                public DataItem keyword2 { get; set; }
                public DataItem keyword3 { get; set; }

                public DataItem keyword4 { get; set; }
                public DataItem keyword5 { get; set; }
                /// <summary>
                /// 备注
                /// </summary>
                public DataItem remark { get; set; } = new DataItem()
                {
                    value = "请及时处理。点击本消息可直接进入小程序处理！"
                };
            }
        }

        /// <summary>
        /// 评价通知
        /// </summary>
        public class PingJiaMsg : WeChartMsg
        {
            /// <summary>
            /// 消息模板ID，固定不能动
            /// </summary>
            public new string template_id { get; set; } = "fKauLZzO9IkbQReWAwRMpPblRkiQ9z8Q60mwC_Vf-gQ";
            /// <summary>
            /// 小程序链接
            /// </summary>
            public XCXPath miniprogram { get; set; }

            public DataModel data { get; set; }
            /// <summary>
            /// 消息内容
            /// </summary>
            public class DataModel
            {
                /// <summary>
                /// 消息首行信息
                /// </summary>
                public DataItem first { get; set; }
                public DataItem keyword1 { get; set; }

                public DataItem keyword2 { get; set; }
                public DataItem keyword3 { get; set; }

                public DataItem keyword4 { get; set; }
                /// <summary>
                /// 备注
                /// </summary>
                public DataItem remark { get; set; } = new DataItem()
                {
                    value = "请及时处理。点击本消息可直接进入小程序处理！"
                };
            }
        }



        /// <summary>
        /// 报价通知
        /// </summary>
        public class BaoJiaMsg : WeChartMsg
        {
            /// <summary>
            /// 消息模板ID，固定不能动
            /// </summary>
            public new string template_id { get; set; } = "QwG9cWeRNIgTR25YYWH0aJpoM7m5CCS-yvKeU6LpFwc";
            /// <summary>
            /// 小程序链接
            /// </summary>
            public XCXPath miniprogram { get; set; }

            public DataModel data { get; set; }
            /// <summary>
            /// 消息内容
            /// </summary>
            public class DataModel
            {
                /// <summary>
                /// 消息首行信息
                /// </summary>
                public DataItem first { get; set; }
                public DataItem keyword1 { get; set; }

                public DataItem keyword2 { get; set; }
                public DataItem keyword3 { get; set; }

                public DataItem keyword4 { get; set; }
                /// <summary>
                /// 备注
                /// </summary>
                public DataItem remark { get; set; } = new DataItem()
                {
                    value = "请及时处理。点击本消息可直接进入小程序处理！"
                };
            }
        }



        /// <summary>
        /// 留言通知
        /// </summary>
        public class LiuYan : WeChartMsg
        {
            /// <summary>
            /// 消息模板ID，固定不能动
            /// </summary>
            public new string template_id { get; set; } = "5rlSvrBdsIq9oHvMEB5Ukq0n8RxpDd0w5LzzoRBFNgQ";
            /// <summary>
            /// 小程序链接
            /// </summary>
            public XCXPath miniprogram { get; set; }

            public DataModel data { get; set; }
            /// <summary>
            /// 消息内容
            /// </summary>
            public class DataModel
            {
                /// <summary>
                /// 消息首行信息
                /// </summary>
                public DataItem first { get; set; } = new DataItem()
                {
                    value = "您有新的留言"
                };
                /// <summary>
                /// 客户名称
                /// </summary>
                public DataItem keyword1 { get; set; }
                /// <summary>
                /// 时间
                /// </summary>
                public DataItem keyword2 { get; set; }

        

                public DataItem keyword3 { get; set; } = new DataItem()
                {
                    value = "审核通过"
                };
                /// <summary>
                /// 备注
                /// </summary>
                public DataItem remark { get; set; } = new DataItem()
                {
                    value = "请及时处理。点击本消息可直接进入小程序处理！"
                };
            }
        }


        /// <summary>
        /// 服务进度通知
        /// </summary>
        public class ServiceFlag : WeChartMsg
        {
            /// <summary>
            /// 消息模板ID，固定不能动
            /// </summary>
            public new string template_id { get; set; } = "p82U9X_aa-fEu3aD_EINkBOehHX5oevMkLZ8juF3vR8";
            public new  string touser { get; set; }
            /// <summary>
            /// 小程序链接
            /// </summary>
            public  string miniprogram_state { get; set; } = ALLminiprogram_state;

            public string page { get; set; }

            public DataModel data { get; set; }
            /// <summary>
            /// 消息内容
            /// </summary>
            public class DataModel
            {
                //服务项目
                public DataItem thing1 { get; set; }
            
                //服务状态
                public DataItem thing2 { get; set; }
                //服务电话
                public DataItem number4 { get; set; }
                //服务时间
                public DataItem time18 { get; set; }
                //温馨提示
                public DataItem thing6 { get; set; }
                /// <summary>
                /// 备注
                /// </summary>
                public DataItem remark { get; set; } = new DataItem()
                {
                    value = "请及时处理。点击本消息可直接进入小程序处理！"
                };
            }
        }


        /// <summary>
        /// 检测报告提醒
        /// </summary>
        public class CheckInfo : WeChartMsg
        {
            /// <summary>
            /// 消息模板ID，固定不能动
            /// </summary>
            public new string template_id { get; set; } = "KRumdZD_s8DICJD7DP0aOFUtdin-SZ5ohzaRucqZIAw";
            public new string touser { get; set; }
            /// <summary>
            /// 小程序链接
            /// </summary>
            public string miniprogram_state { get; set; } = ALLminiprogram_state;

            public string page { get; set; }

            public DataModel data { get; set; }
            /// <summary>
            /// 消息内容
            /// </summary>
            public class DataModel
            {
                //检测门店
                public DataItem thing10 { get; set; }

                //检测结果
                public DataItem thing3 { get; set; }
                //温馨提醒
                public DataItem thing4 { get; set; }
          
                public DataItem time2 { get; set; }
       
           
            }
        }


        /// <summary>
        /// 结算提醒
        /// </summary>
        public class JieSuanInfo : WeChartMsg
        {
            /// <summary>
            /// 消息模板ID，固定不能动
            /// </summary>
            public new string template_id { get; set; } = "oS-5uB3oQ-68RWbjIoqe9x-2T7Cr3Ny9mpIdtia5m0w";
            public new string touser { get; set; }
            /// <summary>
            /// 小程序链接
            /// </summary>
            public string miniprogram_state { get; set; } = ALLminiprogram_state;

            public string page { get; set; }

            public DataModel data { get; set; }
            /// <summary>
            /// 消息内容
            /// </summary>
            public class DataModel
            {
                //检测门店
                public DataItem phrase3 { get; set; }

                //检测结果
                public DataItem character_string1 { get; set; }

                //温馨提醒
                public DataItem car_number2 { get; set; }

                public DataItem amount4 { get; set; }

                public DataItem thing5 { get; set; }
            }
        }



        /// <summary>
        /// 接车提醒
        /// </summary>
        public class JiaoCheInfo : WeChartMsg
        {
            /// <summary>
            /// 消息模板ID，固定不能动
            /// </summary>
            public new string template_id { get; set; } = "qmQbpkAf3sNEiDscpOUlg9cGzuD7S-UGYpz-9z7Zjxs";
            public new string touser { get; set; }
            /// <summary>
            /// 小程序链接
            /// </summary>
            public string miniprogram_state { get; set; } = ALLminiprogram_state;

            public string page { get; set; }

            public DataModel data { get; set; }
            /// <summary>
            /// 消息内容
            /// </summary>
            public class DataModel
            {
                //检测门店
                public DataItem date3 { get; set; }

                //检测结果
                public DataItem thing9 { get; set; }

                //温馨提醒
                public DataItem character_string2 { get; set; }

                public DataItem name5 { get; set; }

                public DataItem thing7 { get; set; }
            }
        }


        /// <summary>
        /// 支付成功消息通知
        /// </summary>
        public class ZhifuMsg : WeChartMsg
        {
            /// <summary>
            /// 消息模板ID，固定不能动
            /// </summary>
            public new string template_id { get; set; } = "LiB-Xu44OHgmlqDvy25FZMQL5EtQznuYuqBJxiF-bTQn5hw";

            /// <summary>
            /// 小程序链接
            /// </summary>
            public XCXPath miniprogram { get; set; }

            public DataModel data { get; set; }
            /// <summary>
            /// 消息内容
            /// </summary>
            public class DataModel
            {
                /// <summary>
                /// 消息首行信息
                /// </summary>
                public DataItem first { get; set; } = new DataItem()
                {
                    value = "您有新的订单"
                };
                /// <summary>
                /// 客户名称
                /// </summary>
                public DataItem keyword1 { get; set; }
                /// <summary>
                /// 付款时间
                /// </summary>
                public DataItem keyword2 { get; set; }
                /// <summary>
                /// 付款方式
                /// </summary>
                public DataItem keyword3 { get; set; }
                /// <summary>
                /// 金额
                /// </summary>
                public DataItem keyword4 { get; set; }
                /// <summary>
                /// 备注
                /// </summary>
                public DataItem remark { get; set; } = new DataItem()
                {
                    value = "请及时处理。点击本消息可直接进入小程序处理！"
                };
            }
        }


        /// <summary>
        /// 客户咨询通知
        /// </summary>
        public class ConsultantMsg : WeChartMsg
        {
            /// <summary>
            /// 消息模板ID，固定不能动
            /// </summary>
            public new string template_id { get; set; } = "3ZdUY41rY64hL0Fxfg7VTaAwrunzdi-Gr0-oLBkgrZ0";
            /// <summary>
            /// 小程序链接
            /// </summary>
            public XCXPath miniprogram { get; set; }

            public DataModel data { get; set; }
            /// <summary>
            /// 消息内容
            /// </summary>
            public class DataModel
            {
                /// <summary>
                /// 消息首行信息
                /// </summary>
                public DataItem first { get; set; } = new DataItem()
                {
                    value = "您好，您有新的消息！"
                };

                public DataItem keyword1 { get; set; }

                public DataItem keyword2 { get; set; }

                public DataItem keyword3 { get; set; }

                /// <summary>
                /// 备注
                /// </summary>
                public DataItem remark { get; set; } = new DataItem()
                {
                    value = "请及时处理。点击本消息可直接进入小程序处理！"
                };
            }
        }

        /// <summary>
        /// 参数值
        /// </summary>
        public class DataItem
        {
            /// <summary>
            /// 显示值
            /// </summary>
            public string value { get; set; }
            /// <summary>
            /// 文字颜色，默认#173177 蓝色
            /// </summary>
            public string color { get; set; } = "#173177";
        }
        /// <summary>
        /// 小程序链接地址
        /// </summary>
        public class XCXPath
        {
            /// <summary>
            /// 小程序appid，聚合盛APPID，固定值不要动
            /// </summary>
            public string appid { get; set; } = "wx9dd93984bf291011";
            /// <summary>
            /// 小程序页面地址和参数，商城地址
            /// </summary>
            public string pagepath { get; set; } = "pages/store/index";
        }


        /// <summary>
        /// 审核结果通知
        /// </summary>
        public class ToExamineMsg : WeChartMsg
        {
            /// <summary>
            /// 消息模板ID，固定不能动
            /// </summary>
            public new string template_id { get; set; } = "OURtyr6Hl1XXXR0LRSp7bKe5mGfC33j30aR-LgCTQvI";
            /// <summary>
            /// 小程序链接
            /// </summary>
            public XCXPath miniprogram { get; set; }

            public DataModel data { get; set; }
            /// <summary>
            /// 消息内容
            /// </summary>
            public class DataModel
            {
                /// <summary>
                /// 消息首行信息
                /// </summary>
                public DataItem first { get; set; } = new DataItem()
                {
                    value = "您好，以下是您发布信息的审核结果！"
                };

                public DataItem keyword1 { get; set; }

                public DataItem keyword2 { get; set; }

                public DataItem keyword3 { get; set; }

                public DataItem keyword4 { get; set; }

                /// <summary>
                /// 备注
                /// </summary>
                public DataItem remark { get; set; } = new DataItem()
                {
                    value = "请及时处理。点击本消息可直接进入小程序处理！"
                };
            }
        }


    }
}